I would like to use an attribute as a trigger to allow write access for the object text. how do I do that for a module using DXL? I am very new to DXL, an example or a simple script would be very helpful. for example, when object 123's attribute A is set to "ready", then allow write access to the object text for object 123. when the attribute A is set to other, then lock the object text from editing. Mengliang - Tue Mar 27 11:45:25 EDT 2018 |
Re: trigger use For simplicity we always we install triggers at the project level, so the trigger applies to all the modules in the project that contain the attribute...in the case of Object Text it would apply to all modules since it is a system attribute. Below is an example of how to install an attribute trigger on a project:
1) First create a file that defines the trigger, for you it will be something like:
Trigger lTrig = current
Object lObj = object(lTrig)
if(lObj."A" "" != "ready"){
set(trigPreConFail)
}
2) Then you need to install that trigger (make sure you have the project selected that you want the trigger to be installed):
Trigger lTrig = trigger("Object_Text_Trigger" , attribute->"Object Text", pre, modify, 10, readFile(lPath_To_DxlFile))
Where lPath_To_DxlFile is a string containing the path to the trigger file you created in step 1. As you experiment, you will probably want to write functions that create, delete and verify the trigger. |